package com.chezi008.libcontacts.ui;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.chezi008.libcontacts.R;
import com.chezi008.libcontacts.bean.ContactBean;
import com.chezi008.libcontacts.listener.ContactListener;
import com.chezi008.libcontacts.listener.ISuspensionInterface;
import com.chezi008.libcontacts.listener.LetterInterface;
import com.cyf.kevin.crazymonkey.adapter.MyBaseAdapter;

import java.util.List;

/**
 * - @Description:
 * - @Author:  chezi008/chezi008@qq.com
 * - @Time:  2019/6/13 10:05
 */
public abstract class ContactAdapter extends MyBaseAdapter implements LetterInterface {

    private final List<? extends ISuspensionInterface> mData;

    public ContactAdapter(List<? extends ISuspensionInterface> data, int layout) {
        super(layout);
        mData = data;
    }

    public int getLetterPosition(String letter) {
        for (int i = 0; i < mData.size(); i++) {
            if (mData.get(i).getSuspensionTag().equals(letter)) {
                return i;
            }
        }
        return -1;
    }

    @Override
    public int getItemCount() {
        return mData.size();
    }

}
